#ifndef __TEST_CASE_MANAGER_H__
#define __TEST_CASE_MANAGER_H__

#include <string>
#include <vector>
#include <stdint.h>

#include <libxml/tree.h>

class TestCase;
struct CaseConditions;


class TestCaseManager
{
public:
    TestCaseManager(const std::string &xmlPath);
    ~TestCaseManager();

    bool Parse();

    uint32_t GetTestCaseNum() const;
    const TestCase &GetTestCase(uint32_t idx) const;
    TestCase &GetTestCase(uint32_t idx);
    void SetTestCase(const TestCase &oneCase);

    void Dump();

private:
    std::string XmlNodeGetContentEx(xmlNodePtr node);
    bool ParseOneCase(xmlNodePtr node);
    bool ParseCaseConditions(xmlNodePtr node, CaseConditions &conditions);
    bool ParseResult(const std::string &xmlPath, TestCase &oneCase);

    void DumpOneCase(xmlNodePtr node, const TestCase &oneCase);
    void DumpCaseConditions(xmlNodePtr node, const CaseConditions &conditions);
    void DumpCaseResult(const std::string &xmlPath, const TestCase &oneCase);

private:
    std::string xmlPath_;
    std::vector<TestCase> cases_;
    xmlDocPtr doc_;
};
#endif
